/*
 * @Descripttion: 
 * @Author: zhangchong zc16607@gmail.com
 * @Date: 2023-02-27 16:08:44
 * @LastEditors: zhangchong zc16607@gmail.com
 * @LastEditTime: 2023-02-28 10:45:17
 */
const mongoose = require('mongoose')
const config = require('../config/default')
const logger = require('./logger')

module.exports = () => {
  mongoose
    .connect(config.dbUrl, {
      autoIndex: true,
      autoCreate: true
    })
    .then(_ => logger.info('数据库连接成功'))
    .catch(_ => logger.info('数据库连接失败'))
}